@extends('admin.layout')

@if(session('master') -> id == $data -> id )
  @section('content')

        <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
         
          <div id="breadcrumbs" class="breadcrumbs">
              <ol class="breadcrumb">
              <li><a href="javascript:void();"><i class="fa fa-home"></i>&nbsp;&nbsp;后台首页</a></li>
                      
                      <li><a href="javascript:void();">个人中心</a></li>           
              </ol>
          </div>

              @if(session('info'))
                <div class="row">
                  <div class="col-xs-6 col-xs-offset-3">
                    <div id="showHidden" class="alert alert-success alert-dismissable">
                      <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                      <h4>  <i class="icon fa fa-check"></i> {{ session('info') }} </h4>
                      
                    </div>
                  </div>
                </div>
              @endif

              @if(session('error'))
                <div class="row">
                  <div class="col-xs-6 col-xs-offset-3">
                    <div id="showHidden" class="alert alert-danger alert-dismissable">
                    <button aria-hidden="true" data-dismiss="alert" class="close" type="button">x</button>
                        <h4><i class="icon fa fa-ban"></i>{{ session('error') }} </h4>
                    </div>
                  </div>
                </div>
             @endif


         <section class="content ">
        <!-- Main content -->
        <div class="container-fluid">
            
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 个人中心</h3>
                </div>
                <div class="panel-body ">   
                    <!--表单数据-->
                    <form action="{{ url('/admin/admin/update_info') }}" id="adminHandle" method="post" enctype="multipart/form-data">  
                    {{csrf_field()}} 
                    <input type="hidden" name="id" value="{{ $data -> id}}">                  
                        <!--通用信息-->
                    <div class="tab-content col-md-10">                       
                        <div id="tab_tongyong" class="tab-pane active">                           
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td class="col-sm-2">用户名：</td>
                                    <td class="col-sm-8">
                                        
                                        @if($errors -> has('username'))
                                        <div class="form-group has-error">
                                            <label for="inputError" class="control-label"><i class="fa fa-times-circle-o"></i>
                                            <?php
                                                echo $errors->first('username');  
                                            ?>  
                                            </label>
                                            <input name="username" type="text" placeholder="{{ $data -> username}}" id="inputError" class="form-control">
                                        </div>
                                        @else 
                                            <input name="username" type="text" value="" name="username" class="form-control" placeholder="{{ $data -> username}}">

                                        @endif
                                    </td>
                                </tr>  
                                <tr>
                                    <td class="col-sm-2">昵称：</td>
                                    <td class="col-sm-8">
                                        
                                        @if($errors -> has('nickname'))
                                        <div class="form-group has-error">
                                            <label for="inputError" class="control-label"><i class="fa fa-times-circle-o"></i>
                                            <?php
                                                echo $errors->first('nickname');  
                                            ?>  
                                            </label>
                                            <input name="nickname" type="text" placeholder="{{ $data -> nickname}}" id="inputError" class="form-control">
                                        </div>
                                        @else 
                                            <input name="nickname" type="text" value="" name="username" class="form-control" placeholder="{{ $data -> nickname}}">

                                        @endif
                                    </td>
                                </tr>  
                                <tr>
                                    <td>Email地址：</td>
                                    <td>    
                                      @if($errors -> has('email'))
                                        <div class="form-group has-error">
                                            <label for="inputError" class="control-label"><i class="fa fa-times-circle-o"></i>
                                             <?php
                                                echo $errors->first('email');  
                                            ?>
                                            </label>
                                            <input name="email" name="username" type="text" placeholder="{{ $data -> email}}" id="inputError" class="form-control">
                                        </div>
                                        @else 
                                            <input type="text" value="" name="email" class="form-control" placeholder="{{ $data -> email}}">
                                        @endif                           
                                    </td>
                                </tr>  
                                <tr>
                                    <td>联系电话：</td>
                                    <td>
                                        @if($errors -> has('phone'))
                                        <div class="form-group has-error">
                                            <label for="inputError" class="control-label"><i class="fa fa-times-circle-o"></i>
                                                <?php
                                                echo $errors->first('phone');  
                                                ?>
                                            </label>
                                            <input name="phone" type="text" placeholder="{{ $data -> phone}}" id="inputError" class="form-control">
                                        </div>
                                        @else 
                                            <input name="phone" for="inputError" type="text" value="" name="phone" class="form-control" placeholder="{{ $data -> phone}}">


                                        @endif
                             
                                    </td>
                                </tr> 
                                <tr>
                                    <td>登陆密码：</td>
                                    <td>
                                        

                                        @if($errors -> has('password'))
                                        <div class="form-group has-error">
                                            <label for="inputError" class="control-label"><i class="fa fa-times-circle-o"></i>
                                                <?php
                                                echo $errors->first('password');  
                                                ?>
                                                </label>
                                            <input name="password" type="text" placeholder="请输入6-20位密码" id="inputError" class="form-control">
                                        </div>
                                        @else 
                                            <input type="password" value="" name="password" class="form-control" placeholder="请输入6-20位密码">
                                        @endif
                                    </td>
                                   

                                </tr>  
                                </tbody> 
                                <tfoot>
                                    <tr>
                                      <td>
                                        <div class="form-group">
                                          <img src="{{ $data-> img }}" width="200" />
                                      </div>
                                      </td>
                                      <td>
                                        <div class="form-group">
                                        <label for="exampleInputFile">上传新头像</label>
                                        <input type="file" name="img" id="exampleInputFile">
                                        <p class="help-block">请选择一张图片作为新头像　类型：jpg，png，gif 文件大小 2MB </p>
                                      </div>
                                      </td>
                                    </tr>
                                    <tr>
                                    <td>
                                    </td>
                                    <td class="text-right"><input type="submit" value="更新" class="btn btn-primary"></td></tr>

                                </tfoot>                            
                                </table>
                        </div>                           
                    </div>              
                   </form><!--表单数据-->             
                    </form><!--表单数据-->
                </div>
            </div>
        </div>
    </section>
    </div>
    <script type="text/javascript">
      
      window.onload = function()
      {

            //自动清楚提示框
            setTimeout("$('#showHidden').hide( )",3000); 
  
      }

    </script>


  @endsection
@else
@section('content')
 <div class="content-wrapper">
    <div class="alert alert-danger alert-dismissable">
      <h4><i class="icon fa fa-ban"></i> 非法操作 </h4>
      <h2>！您没有权限访问此页面，请终止当前操作，否则将追究法律责任！</h2>
    </div>
  </div>
@endsection
@endif